//
//  KKTableHeaderView.m
//  FreightAssistant
//
//  Created by leo on 15/11/8.
//  Copyright © 2015年 leo. All rights reserved.
//

#import "KKTableHeaderView.h"

@implementation KKTableHeaderView


+ (instancetype)headerViewOfCreateOrderWithTableView:(UITableView*)tableView {
    
    KKTableHeaderView *headerView = [[KKTableHeaderView alloc] initWithFrame: CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), 23)];
    headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    
    {
        CGFloat width = CGRectGetWidth(headerView.bounds);
        
        headerView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @"inner_table_header"]];
        
        UIFont *font = [UIFont systemFontOfSize: 13];
        
        UILabel *priceLabel = [[UILabel alloc] initWithFrame: CGRectMake(width - 75, 2, 60, 19)];
        priceLabel.backgroundColor = [UIColor clearColor];
        priceLabel.textAlignment = NSTextAlignmentCenter;
        priceLabel.text = @"售价";
        priceLabel.font = font;
        priceLabel.textColor = [UIColor whiteColor];
        priceLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
        [headerView addSubview: priceLabel];
        
        UILabel *paidLabel = [[UILabel alloc] initWithFrame: CGRectMake(width - 135, 2, 60, 19)];
        paidLabel.backgroundColor = [UIColor clearColor];
        paidLabel.textAlignment = NSTextAlignmentCenter;
        paidLabel.text = @"进价";
        paidLabel.font = font;
        paidLabel.textColor = [UIColor whiteColor];
        paidLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
        [headerView addSubview: paidLabel];
        
        UILabel *numberLabel = [[UILabel alloc] initWithFrame: CGRectMake(width - 175, 2, 40, 19)];
        numberLabel.backgroundColor = [UIColor clearColor];
        numberLabel.textAlignment = NSTextAlignmentCenter;
        numberLabel.text = @"数量";
        numberLabel.font = font;
        numberLabel.textColor = [UIColor whiteColor];
        numberLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
        [headerView addSubview: numberLabel];
        
        UILabel *nameLabel = [[UILabel alloc] initWithFrame: CGRectMake(15, 2, width - 185, 19)];
        nameLabel.backgroundColor = [UIColor clearColor];
        nameLabel.textAlignment = NSTextAlignmentCenter;
        nameLabel.text = @"名称";
        nameLabel.font = font;
        nameLabel.textColor = [UIColor whiteColor];
        [headerView addSubview: nameLabel];
    }
    
    return headerView;
}

@end
